﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Services;

public partial class Admin_Product : System.Web.UI.Page
{
    ProductsController productsController = new ProductsController();
    protected void Page_Load(object sender, EventArgs e)
    {
        grvProduct.DataSource = productsController.GetAll();
        grvProduct.DataBind();
        if(grvProduct.Rows.Count>0)
        {
            grvProduct.UseAccessibleHeader = true;
            grvProduct.HeaderRow.TableSection = TableRowSection.TableHeader;
        }
    }
    [WebMethod]
    public static string deleteProduct(int product_id)
    {
        ProductsController productsController = new ProductsController();
        if(productsController.Delete(product_id)>0)
        {
            return "true";
        }
        else
        {
            return "false";
        }
    }
}